package com.example.ssm.bean;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by Intellij IDEA.
 * User: JonnyJiang
 * Date: 2021/6/6
 */
public class CommonResult implements Serializable {


    /**
     * 200 成功
     *
     */
    private int status;
    private String msg;
    private Map<String,Object> data;

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Map<String, Object> getData() {
        return data;
    }

    public void setData(Map<String, Object> data) {
        this.data = data;
    }

    public CommonResult(int status, String msg) {
        this.status = status;
        this.msg = msg;
        data = new HashMap<>();
    }

    public CommonResult(int status, String msg, Map<String, Object> data) {
        this.status = status;
        this.msg = msg;
        this.data = data;
    }


    public CommonResult add(String key, Object value){
        data.put(key,value);
        return this;
    }

    @Override
    public String toString() {
        return "CommonResult{" +
                "status=" + status +
                ", msg='" + msg + '\'' +
                ", data=" + data +
                '}';
    }
}
